import axios from "axios";
import { Notify } from 'vant';
axios.defaults.withCredentials = true;

const service = axios.create({
  baseURL: "http://www.iscatseven.top:4900/",
  timeout: 20000,
});

service.interceptors.request.use(config => {
  return config
}, error => {
  Promise.reject(error)
});

service.interceptors.response.use(res => {
  if (res.data.code != 200)
  {
    Notify({
      type: 'warning',
      message: res.data.msg
    })
  }
  return res.data
}, error => {
  Notify({
    type: 'danger',
    message: "服务器未知错误"
  })
  return Promise.reject(error);
});

export default service;